package com.changgou.search.listener;

import com.changgou.search.config.RabbitMQConfig;
import com.changgou.search.service.ESManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: HuangFu
 * @Date: 2020/2/1 21:58
 * @Description: 商品上架监听
 */
@Component
public class GoodsUpListener {
    @Autowired
    private ESManagerService esManagerService;

    @RabbitListener(queues = RabbitMQConfig.SEARCH_ADD_QUEUE)
    public void consumeMessage(String spuId){
        System.out.println("需要上架的商品id:"+spuId);
        esManagerService.importDataBySpuId(spuId);
    }

}
